Skip to content

[codex] Avoid torch for PE rebuild import and help#191

Open
anth-volk wants to merge 1 commit into
mainfrom
codex/fix-146-narrow-lazy-imports
Open

[codex] Avoid torch for PE rebuild import and help#191
anth-volk wants to merge 1 commit into
mainfrom
codex/fix-146-narrow-lazy-imports

Conversation

@anth-volk
Copy link
Copy Markdown
Contributor

Fixes #146

Summary

  • Makes the microplex_us package root resolve convenience exports lazily, including the previously eager microplex.targets and validation/geography-facing exports.
  • Keeps the PE-US rebuild checkpoint module import-light by replacing heavy module-level imports with thin lazy wrappers and local runtime imports.
  • Splits checkpoint CLI parser construction into build_policyengine_us_data_rebuild_checkpoint_parser() so --help exits before stage/runtime execution imports are needed.

Validation

  • uv run --no-sync ruff check src/microplex_us/__init__.py src/microplex_us/pipelines/pe_us_data_rebuild_checkpoint.py tests/test_package_imports.py
  • uv run --no-sync pytest -q tests/test_package_imports.py tests/pipelines/test_pe_us_data_rebuild_checkpoint.py -> 28 passed
  • uv run --no-sync python -m py_compile src/microplex_us/__init__.py src/microplex_us/pipelines/pe_us_data_rebuild_checkpoint.py tests/test_package_imports.py
  • uv run --no-sync python -m microplex_us.pipelines.pe_us_data_rebuild_checkpoint --help

Notes

  • This replaces [codex] Split PE rebuild CLI parsing from runtime imports #154 with a narrower implementation. It avoids the broad _load_runtime_symbols() design and keeps existing checkpoint monkeypatch seams working via lazy wrapper functions.
  • GitNexus MCP tools were not available in this session, and no local .gitnexus index files were visible in this worktree, so I used targeted rg caller/import checks plus git diff --check for the impact/scope fallback.

@anth-volk anth-volk marked this pull request as ready for review June 3, 2026 14:58
@anth-volk anth-volk requested a review from MaxGhenis June 3, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PE-US rebuild CLI import requires torch through microplex top-level import even when neural synthesis is unused

1 participant